package cc.catface.api.business.admin;

import cc.catface.common.output.ResultBody;
import cc.catface.dao.admin.pojo.AdLabel;
import cc.catface.service.admin.AdLabelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/admin/v1/label")
@Api(tags = "[管理]频道标签")
public class AdLabelController {
    @Autowired
    private AdLabelService labelService;

    @ApiOperation("新增标签")
    @PostMapping("add")
    public ResultBody add(@RequestBody AdLabel label) {
        return labelService.add(label);
    }

    @ApiOperation("修改标签(根据id)")
    @PostMapping("update")
    public ResultBody update(@RequestBody AdLabel label) {
        return labelService.update(label);
    }

    @ApiOperation("查询所有标签")
    @GetMapping("list")
    public ResultBody list() {
        return labelService.list();
    }
}
